<!--  -->
<script setup>
import PopWindow from '@/components/PopWindow.vue'
import { ref } from 'vue'
import SubmitBtn from '@/components/button/SubmitBtn.vue'
import Select from '@/components/input/Select.vue'

defineProps(['condition', 'info'])
const emit = defineEmits(['close', 'submit'])


const resolveUserOptions = ['封禁', '警告']
const resolveUserBanOptions = ['天', '周', '月', '永久']
const resolveUserDayOptions = [1, 3, 5]
const resolveTypeOptions = ['删除', '关闭', '修改']
const selectedUserOption = ref('警告')
const selectedUserDayOption = ref(1)
const selectedUserBanOption = ref('天')
const selectedTypeOption = ref('删除')


const form = ref({
  reason: [],
  info: '',
})

function submit() {

  emit('submit', form.value)
}

</script>

<template>
  <PopWindow :condition="condition" @close="$emit('close')">
    <div class="pop-window-header">
      <div class="title">Resolve</div>
    </div>
    <div class="pop-window-body">
      <div class="label">处理 {{ info }} 的举报</div>
      <div class="label">处理违规用户</div>
      <div class="flex">
        <Select w="80px" :default="selectedUserOption" @on-select="v => selectedUserOption = v"
          :options="resolveUserOptions"></Select>
        <div class="flex" v-if="selectedUserOption !== '警告'">
          <Select w="80px" :default="selectedUserDayOption" @on-select="v => selectedUserDayOption = v"
            :options="resolveUserDayOptions"></Select>
          <Select w="80px" :default="selectedUserBanOption" @on-select="v => selectedUserBanOption = v"
            :options="resolveUserBanOptions"></Select>
        </div>
      </div>
      <textarea v-model="form.info"></textarea>
      <p class="label">处理违规内容</p>
      <Select w="80px" :default="selectedTypeOption" @on-select="v => selectedTypeOption = v"
        :options="resolveTypeOptions"></Select>
    </div>
    <div class="pop-window-footer">
      <SubmitBtn @click="submit">提交</SubmitBtn>
    </div>
  </PopWindow>
</template>

<style scoped lang="scss">
.pop-window-header {

  .title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 2rem;
    color: var(--text-03);
  }
}

.pop-window-body {
  flex: 1;
  margin: 2em 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;

  .btn {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .checkbox-container {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .label {
    font-weight: 400;
    color: var(--text-02);

    .desc {
      margin-left: 10px;
      font-size: 0.8rem;
      color: #979797;
    }
  }

  .pop-window-footer {
    display: flex;
    justify-content: end;
  }
}

textarea {
  padding: 4px 11px;
  font-size: 14px;
  line-height: 1.5;
  color: #444c3f;
  outline: none;
  border: 1px solid #9cb294;
  background-color: var(--bgc-02);
  border-radius: 2px;
}

textarea {
  min-height: 50px;
  height: 50px;
  resize: vertical;
}
</style>
